<?php
/**
 * Joomla! 1.5 component JoomGPSTracks
 *
 * @version $Id: config.php 2009-06-24 15:40:19 svn $
 * @author Michael Pfister
 * @package joomGPStracks
 * @subpackage backend
 * @license GNU/GPL
 * @filesource
 *
 */


// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.controller' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'helper.php' );
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_petcare'.DS.'tables');
/**
 * Controller Class Configuration
 */
class JoomgpstracksControllerConfig extends JoomgpstracksController  {
    /**
     *
     */
    function display()
    {

	    parent::display();
    }
    /**
     *
     * @global object $mainframe
     * @uses JoomgpstracksModelConfigat::saveConfig
     * @return  redirect
     */
    function saveconfig()  {
        global $mainframe;

        // check the token
        JRequest::checkToken() or die( 'Invalid Token' );

        $model = $this->getModel('config');
        $model->saveConfig();

        $link = JRoute::_( "index.php?option=com_joomgpstracks&task=config&controller=config",false);
        $this->setRedirect($link, JText::_('GPS_CONFIG_SAVED'));

    }

    /**
     *
     * @global object $mainframe
     * @return boolean
     */
    function installClean()  {
        global $mainframe;


        $model = $this->getModel('config');
        if(!$model->installCleanDB())  {
            return false;
        } else {
            return true;
        }

    }

    /**
     *
     * @global object $mainframe
     * @return boolean
     */
    function installUpdate()  {
        global $mainframe;

        $model = $this->getModel('config');
        if(!$model->updateDB()) {
            return false;
        } else {
            return true;
        }
    }
}
?>

